<template>
	<view>
		<map class="map" name=""></map>
		<view class="" style="margin-top: 800rpx;" v-for="item,index in mapList" :key="index">
			{{item[0].title}}
		</view>
	</view>
</template>

<script>
	import {
		https
	} from '../../utils/request.js'
	export default {
		data() {
			return {
				key: 'JWYBZ-CW2RI-P5ZGZ-UBQ3D-CGY4S-GQBON',
				qqmapsdk: '',
				mapList: [],
				id: ''
			};
		},
		// 引入SDK核心类，js文件根据自己业务，位置可自行放置

		onLoad: function() {
			var QQMapWX = require('../../utils/qqmap-wx-jssdk');
			// 实例化API核心类
			this.qqmapsdk = new QQMapWX({
				key: this.key
			});
			uni.createMapContext(this.id)
		},
		onShow: function() {
			// 调用接口
			this.qqmapsdk.search({
				keyword: '酒店',
				success: function(res) {
					console.log(1, res);
					this.mapList = res.data
					this.id = res.data.id
				},
				fail: function(res) {
					console.log(2, res);
				},
				complete: function(res) {
					console.log(3, res);
				}
			});
		},
	}
</script>

<style lang="scss">
	.map {
		width: 750rpx;
		height: 750rpx;
	}
</style>